package top.forforever.srb.core.controller.admin;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.forforever.srb.common.result.R;
import top.forforever.srb.core.pojo.entity.UserInfo;
import top.forforever.srb.core.pojo.vo.UserInfoQuery;
import top.forforever.srb.core.service.UserInfoService;

/**
 * <p>
 * 用户基本信息 前端控制器
 * </p>
 *
 * @author Mr.Jiang
 * @since 2023-04-29
 */
@RestController
@RequestMapping("/admin/core/userInfo")
public class AdminUserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    @GetMapping("/getPageList/{page}/{limit}")
    public R getPageList(@PathVariable Integer page, @PathVariable Integer limit,
                         UserInfoQuery userInfoQuery) {
        Page<UserInfo> pageParam  = userInfoService.getPageList(page,limit,userInfoQuery);
        return R.ok().data("list",pageParam.getRecords()).data("total",pageParam.getTotal());
    }

    @PutMapping("/updateStatus/{id}/{status}")
    public R updateStatus(@PathVariable Long id, @PathVariable Integer status) {
        userInfoService.updateStatus(id,status);
        return R.ok();
    }

}

